import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { StandardJobVO, StandardJobForm, StandardJobQuery } from '@/api/agriculture/standardJob/types';

/**
 * 查询标准作业任务列表
 * @param query
 * @returns {*}
 */

export const listStandardJob = (query?: StandardJobQuery): AxiosPromise<StandardJobVO[]> => {
  return request({
    url: '/agriculture/standardJob/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询标准作业任务详细
 * @param jobId
 */
export const getStandardJob = (jobId: string | number): AxiosPromise<StandardJobVO> => {
  return request({
    url: '/agriculture/standardJob/' + jobId,
    method: 'get'
  });
};

/**
 * 新增标准作业任务
 * @param data
 */
export const addStandardJob = (data: StandardJobForm) => {
  return request({
    url: '/agriculture/standardJob',
    method: 'post',
    data: data
  });
};

/**
 * 修改标准作业任务
 * @param data
 */
export const updateStandardJob = (data: StandardJobForm) => {
  return request({
    url: '/agriculture/standardJob',
    method: 'put',
    data: data
  });
};

/**
 * 删除标准作业任务
 * @param jobId
 */
export const delStandardJob = (jobId: string | number | Array<string | number>) => {
  return request({
    url: '/agriculture/standardJob/' + jobId,
    method: 'delete'
  });
};
